( function(){
    window.formatValue = function( value ){
	    if( isNaN( value ) || null === value )
		return value;
	    var str = new String( value );
	    return ( /\./ ).test( str ) ? str.replace( /(\d{1,3})(?=(\d{3})+\.)/g, '$1,' ) : str.replace( /(\d{1,3})(?=(\d{3})+$)/g, '$1,' );
    }
})();
